import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
type int = number;
//class DomWarCopyRewardsConfig
    
    export  class DomWarCopyRewardsConfig
    {
        constructor()
        {
            
            if (DomWarCopyRewardsConfig._instance) 
            {
                throw new Error("DomWarCopyRewardsConfig instance !");
            }
            this.initi();
            return;
        }

        /* internal  */initi(): void
        {
            var loc1=ConfigManager.instance.getObjectByFileName("domWarCopyRewards.xml");
            this.parseXml(loc1.items);
            return;
        }

        /* internal  */parseXml(arg1: Array<any>): void
        {
            var loc1=null;
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            var loc2=0;
            var loc3=arg1;
            for(loc1 of loc3) 
            {
                this._map[loc1.type] = loc1.item;
            }
            return;
        }

        public getRewardsByKill(arg1: int): int
        {
            var loc2=null;
            var loc3=null;
            var loc4=0;
            var loc5=0;
            var loc1=0;
            if (arg1 > 0) 
            {
                loc2 = this._map.killPlayer as Array<any>;
                loc4 = loc2.length;
                loc5 = 0;
                while (loc5 < loc4) 
                {
                    loc3 = loc2[loc5];
                    if (arg1 >= parseInt(loc3.st) && arg1 <= parseInt(loc3.end)) 
                    {
                        loc1 = parseInt(loc3.rewardsPer) * arg1;
                        if (loc1 > parseInt(loc3.total)) 
                        {
                            loc1 = parseInt(loc3.total);
                        }
                    }
                    ++loc5;
                }
            }
            return loc1;
        }

        public getRewardsByRank(arg1: int): int
        {
            var loc3=null;
            var loc1=0;
            var loc2=this._map.damageRank as Array<any>;
            var loc4=loc2.length;
            var loc5=0;
            while (loc5 < loc4) 
            {
                loc3 = loc2[loc5];
                if (arg1 >= parseInt(loc3.st) && arg1 <= parseInt(loc3.end)) 
                {
                    loc1 = parseInt(loc3.rewards);
                    break;
                }
                ++loc5;
            }
            return loc1;
        }

        public static get instance(): DomWarCopyRewardsConfig
        {
            return DomWarCopyRewardsConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: DomWarCopyRewardsConfig;
    }

            DomWarCopyRewardsConfig._instance = new DomWarCopyRewardsConfig();
        